package 作业;

import java.util.Scanner;

public class 绝对值 {
    public static void main(String[] args) {
        while (true) {
            Scanner sc = new Scanner(System.in);

            System.out.println("请输入一个数值：");
            double num = sc.nextDouble();

            double num2 = getJdz(num);

            System.out.println("这个数的绝对值是：" + num2);
        }
    }

    public static double getJdz(double num) {
        if (num >= 0) {
            return num;
        } else {
            return -num;
        }
    }
}
